@echo off
setlocal enabledelayedexpansion

echo ========================================
echo JSZ Translator Installation Script
echo ========================================

REM Set target directory
set "TARGET_DIR=D:\rsoft\mybin\bin"

REM Check if target directory exists
if not exist "%TARGET_DIR%" (
    echo Error: Target directory %TARGET_DIR% does not exist
    echo Please ensure the directory exists and try again
    pause
    exit /b 1
)

echo Installing to: %TARGET_DIR%
echo.

REM Copy executable file
echo Copying jsz.exe...
copy "jsz.exe" "%TARGET_DIR%\" >nul
if errorlevel 1 (
    echo Error: Failed to copy jsz.exe
    pause
    exit /b 1
)
echo ✓ jsz.exe copied successfully

REM Copy configuration files
echo Copying configuration files...

echo Copying keywords.conf...
copy "keywords.conf" "%TARGET_DIR%\" >nul
if errorlevel 1 (
    echo Error: Failed to copy keywords.conf
    pause
    exit /b 1
)
echo ✓ keywords.conf copied successfully

echo Copying messages.conf...
copy "messages.conf" "%TARGET_DIR%\" >nul
if errorlevel 1 (
    echo Error: Failed to copy messages.conf
    pause
    exit /b 1
)
echo ✓ messages.conf copied successfully

echo Copying messages_en.conf...
copy "messages_en.conf" "%TARGET_DIR%\" >nul
if errorlevel 1 (
    echo Error: Failed to copy messages_en.conf
    pause
    exit /b 1
)
echo ✓ messages_en.conf copied successfully

echo Copying messages_zh.gbk.conf...
copy "messages_zh.gbk.conf" "%TARGET_DIR%\" >nul
if errorlevel 1 (
    echo Error: Failed to copy messages_zh.gbk.conf
    pause
    exit /b 1
)
echo ✓ messages_zh.gbk.conf copied successfully

echo Copying simple.conf...
copy "simple.conf" "%TARGET_DIR%\" >nul
if errorlevel 1 (
    echo Error: Failed to copy simple.conf
    pause
    exit /b 1
)
echo ✓ simple.conf copied successfully

echo.
echo ========================================
echo Installation Complete!
echo ========================================
echo.
echo Installed files:
echo - jsz.exe
echo - keywords.conf
echo - messages.conf
echo - messages_en.conf
echo - messages_zh.gbk.conf
echo - simple.conf
echo.
echo You can now use 'jsz' command from anywhere!
echo Example: jsz myfile.jsz
echo.
pause